package com.sea.physical.mapper;


import com.sea.physical.entity.StockProduce;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 库存调拨接口
 */
public interface StockProduceMapper {

    /**
     * 条件查询
     * @param stockProduce
     * @return
     */
    List<StockProduce> findByCnd(StockProduce stockProduce);

    /**
     * 新增
     * @param stockProduce
     * @return
     */
    int insert(StockProduce stockProduce);
    /**
     * 根据仓库ID和SKU获取剩余量
     * @param stockWareId
     * @param stockSku
     * @param createNumber
     * @return
     */
    Integer getStockNumber(@Param("stockWareId")Integer stockWareId,
                           @Param("stockSku")String stockSku,
                           @Param("createNumber")Integer createNumber);

    /**
     * 获取可占用量
     * @param stockWareId
     * @param stockSku
     * @return
     */
    List<StockProduce> getUseNumber(@Param("stockWareId")Integer stockWareId, @Param("stockSku")String stockSku);
    /**
     * 更新占有量
     * @param useNumber
     * @param id
     * @return
     */
    int updateUseNumber(@Param("useNumber")Integer useNumber,@Param("id")Integer id);
    /**
     * 释放占有量以及消耗库存
     * @param useNumber
     * @param id
     * @return
     */
    int updateStockNumber(@Param("useNumber")Integer useNumber,@Param("id")Integer id);
    /**
     * 释放占有量
     * @param useNumber
     * @param id
     * @return
     */
    int cancelUseNumber(@Param("useNumber")Integer useNumber,@Param("id")Integer id);

    List<StockProduce> findSalesProduceNumber(StockProduce stockProduce);

    /**
     * 查询导入的数据
     * @param stockProduce
     * @return
     */
    StockProduce findByImportData(StockProduce stockProduce);

    /**
     *
     * @param stockProduce
     * @return
     */
    Integer updateImportUseNumber(StockProduce stockProduce);
}
